class Solution:
    def rotate(self, nums, k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        if len(nums) == 0:
            return
        k = k%len(nums)
        if k == 0:
            return
        tmp = nums[-k:]
        for i in range(len(nums) - k -1, -1, -1):
            nums[i+k] = nums[i]
        nums[0:k] = tmp



if __name__ == '__main__':
    so = Solution()
    s = [1,2,3,4,5,6,7]
    k = 3
    r = so.rotate(s, k)
    print(s)
